package com.kkks.spring_rest.tick.dao.impl;

import java.util.List;
import java.util.Map;

public class Page {
	
	public static final int NUMBERS_PER_PAGE = 20; 
	private int totalCount;//总页数
	private List<?> result = null;//结果集
	private List<Map<String, Object>> list = null;//结果集
	private int pageNum = -1;//当前页数

	public Page() {
	}

	public String getSQLCount(String sql){  
        String sqlBak = sql.toUpperCase();  
        String sqlCount = "SELECT COUNT(*) FROM ("+ sqlBak + ") temp";  
        return sqlCount;  
    } 
	
	
	public int getTotalCount() {
		return totalCount;
	}

	// 计算总页数  
    public void setTotalCount(int numPerPage,int totalRows) {  
        if (totalRows % numPerPage == 0) {  
            this.totalCount = totalRows / numPerPage;  
        } else {  
            this.totalCount = (totalRows / numPerPage) + 1;  
        }  
    }


	public List<?> getResult() {
		return result;
	}

	public void setResult(List<?> result) {
		this.result = result;
	}

	
	public List<Map<String, Object>> getList() {
		return list;
	}

	public void setList(List<Map<String, Object>> list) {
		this.list = list;
	}

	public int getPageNum() {
		return pageNum;
	}

	public void setPageNum(int pageNum) {
		this.pageNum = pageNum;
	}
	

	
}
